FIX: Fix possible SSRF bypass in _is_azure_blob_url host parsing#2180
Merged
Conversation
rlundeen2
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
_is_azure_blob_urlderived the host by manually splittingnetlocon":", which mis-parses URLs that embed userinfo (user@host). A crafted URL such ashttps://a.blob.core.windows.net:80@127.0.0.1:6666was classified as an allowed Azure Blob URL even though the real host is127.0.0.1, letting the allowlist be bypassed and enabling an SSRF via_sign_blob_url_async. This replaces the hand-rolled parsing withurlparse(...).hostname.Changes
pyrit/backend/mappers/attack_mappers.py— useparsed.hostname(RFC 3986-aware) instead ofparsed.netloc.split(":")[0], and add abool(host)guard sincehostnamereturnsNonefor unparseable input. This is becausenetloc.split(":")[0]stops at the first colon and returns theuserportion ofuser@host, so the blob-looking credential segment was treated as the host..hostnamereturns the actual connection target, correctly failing the.blob.core.windows.netsuffix check.Tests and Documentation
tests/unit/backend/test_mappers.py— add a regression test asserting the userinfo-spoofed payload is rejected.